package top.igotcha.chapter.chapter7.ScheduledThreadPoolExecutor01;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @author Gotcha
 * @date 2021/3/15
 * @describe ScheduledThreadPool定时执行
 */
@Slf4j(topic = "ScheduledThreadPoolExecutorTest01")
public class ScheduledThreadPoolExecutorTest02 {
    public static void main(String[] args) {
        ScheduledExecutorService pool = Executors.newScheduledThreadPool(2);
        pool.scheduleAtFixedRate(()-> log.debug("Task"),1,1, TimeUnit.SECONDS);
    }
}
